const redis = require('redis');
var bluebird = require('bluebird');
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
class IRedis{
  constructor(){
    this.client = null;
    this.connectRedis();
  }
  static getInstance(){
    if (!IRedis.instance) {
      console.log('new IRedis')
      IRedis.instance = new IRedis();
    }
    return IRedis.instance;
  }
  async connectRedis(){
     this.client = await redis.createClient('6379','127.0.0.1');
     this.client.on('error',function(error){
       console.log(error)
     }) 
  }
}
export default IRedis;